; D:\PORNPOJ\Y2005\INC361\EX2010\SC01.C - Compiled by CC68K  Version 5.00 (c) 1991-2005  Peter J.Fondse
; #define SW *(unsigned char*)0xe001
; #define LED *(unsigned char*)0xe003
; void main()
; {
       section   code
       xdef      _main
_main:
       link      A6,#-4
       movem.l   D2/D3/D4/D5,-(A7)
; unsigned char swBuff;
; unsigned char ledBuff = 0;
       clr.b     D4
; unsigned char swPattern = 0x01;
       moveq     #1,D3
; unsigned char ledPattern = 0x80;
       move.b    #128,D2
; int i;
; while(1)
main_1:
; {
; //   LED = (~SW  & 0xfc) | 0xc0 ;  //bit wise
; swBuff = SW;
       move.b    57345,-1(A6)
; for(i=0;i<8;i++)
       clr.l     D5
main_4:
       cmp.l     #8,D5
       bge.s     main_6
; {
; if((swBuff & swPattern) != 0)
       move.b    -1(A6),D0
       and.l     #255,D0
       and.l     #255,D3
       and.l     D3,D0
       beq.s     main_7
; {
; ledBuff = ledBuff | ledPattern ;
       or.b      D2,D4
main_7:
; }
; swPattern = swPattern << 1;
       asl.l     #1,D3
; ledPattern = ledPattern >>1;
       asr.l     #1,D2
main_5:
       addq.l    #1,D5
       bra       main_4
main_6:
; }
; LED = ledBuff;
       move.b    D4,57347
; ledBuff = 0;
       clr.b     D4
; swPattern = 0x01;
       moveq     #1,D3
; ledPattern = 0x80;
       move.b    #128,D2
main_2:
       bra       main_1
main_3:
       movem.l   (A7)+,D2/D3/D4/D5
       unlk      A6
       rts
; }
; }
